//
//  UIColor+ZY.m
//  ShareParking
//
//  Created by STAR on 2017/7/26.
//  Copyright © 2017年 zjw. All rights reserved.
//

#import "UIColor+ZY.h"

@implementation UIColor (ZY)

+ (UIColor *)color_main_50D2C2 {
    return [UIColor colorWithHEX:0x50D2C2];
}
+ (UIColor *)color_1D1D26 {
    return [UIColor colorWithHEX:0x1D1D26];
}
+ (UIColor *)color_FFB258 {
    return [UIColor colorWithHEX:0xFFB258];
}
+(UIColor *)color_CFCFCF {
    return [UIColor colorWithHEX:0xCFCFCF];
}
+ (UIColor *)color_F8F8F9 {
    return [UIColor colorWithHEX:0xf8f8f9];
}
+ (UIColor *)color_4FD2C2 {
    return [UIColor colorWithHEX:0x4FD2C2];
}
+ (UIColor *)color_FFB158 {
    return [UIColor colorWithHEX:0xFFB158];
}
+ (UIColor *)color_FB5563 {
    return [UIColor colorWithHEX:0xFB5563];
}

+ (UIColor *)color_F2F2F2 {
    return [UIColor colorWithHEX:0xF2F2F2];
}

+ (UIColor *)colorWithHEX:(NSUInteger)hex {
    CGFloat red, green, blue, alpha;
    
    red = ((CGFloat)((hex >> 16) & 0xFF)) / ((CGFloat)0xFF);
    green = ((CGFloat)((hex >> 8) & 0xFF)) / ((CGFloat)0xFF);
    blue = ((CGFloat)((hex >> 0) & 0xFF)) / ((CGFloat)0xFF);
    alpha = hex > 0xFFFFFF ? ((CGFloat)((hex >> 24) & 0xFF)) / ((CGFloat)0xFF) : 1;
    
    return [UIColor colorWithRed: red green:green blue:blue alpha:alpha];
}
+ (UIColor *)colorWithHEX:(NSUInteger)hex alpha:(CGFloat)alpha {
    CGFloat red, green, blue;
    red = ((CGFloat)((hex >> 16) & 0xFF)) / ((CGFloat)0xFF);
    green = ((CGFloat)((hex >> 8) & 0xFF)) / ((CGFloat)0xFF);
    blue = ((CGFloat)((hex >> 0) & 0xFF)) / ((CGFloat)0xFF);
    return [UIColor colorWithRed: red green:green blue:blue alpha:alpha];
    
}
- (uint)hex {
    CGFloat red, green, blue, alpha;
    if (![self getRed:&red green:&green blue:&blue alpha:&alpha]) {
        [self getWhite:&red alpha:&alpha];
        green = red;
        blue = red;
    }
    
    red = roundf(red * 255.f);
    green = roundf(green * 255.f);
    blue = roundf(blue * 255.f);
    alpha = roundf(alpha * 255.f);
    
    return ((uint)alpha << 24) | ((uint)red << 16) | ((uint)green << 8) | ((uint)blue);
}

@end
